home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 June
/
EnigmA AMIGA RUN 19 (1997)(G.R. Edizioni)(IT)[!][issue 1997-06][EAR-CD III].iso
/
softwareupdate
/
system
/
atapi_pnp300
/
developer_kit
/
opendoor.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-22
|
2KB
|
58 lines
/****************************************************************************
*
*
* $VER: OpenDoor.c 1.0 (22 Jan 1996) by M_Campinoti CD++
*
* $HISTORY:
*
* 22 Jan 1996 : 001.000 : First and Last release of an example that show
* how to open the drive door by means of CD_EJECT command.
* Didactical use, so CLI & WB :)
*
****************************************************************************/
#include <proto/exec.h>
#include <exec/devices.h>
#include <exec/io.h>
#include <stdio.h>
#include "atapi_cd.h"
#define OPEN_DOOR 1
#define CLOSE_DOOR 0
main (void)
{
struct IOStdReq *ioreq = NULL ;
struct MsgPort *reply = NULL ;
if( reply = CreateMsgPort() )
{
if( ioreq = (struct IOStdReq *)
CreateIORequest(reply ,sizeof(struct IOStdReq)) )
{
if(!OpenDevice("cd.device",0,(struct IORequest*)ioreq,NULL) )
{
ioreq->io_Command = CD_EJECT ;
ioreq->io_Length = OPEN_DOOR ; /* <-- change here to close the drive door */
ioreq->io_Offset = 0 ;
DoIO((struct IORequest*)ioreq);
if (!ioreq->io_Error) /* Command succeeded */
{
}
else printf("I/O error !\n"); /* analyze ioreq->io_Error to know what kind ... */
/* ... see atapi_cd.h for #defines of it ! */
CloseDevice((struct IORequest *)ioreq) ;
}
DeleteIORequest(ioreq) ;
}
DeleteMsgPort(reply);
}
}